package cdu.sl.common.utils;

import io.swagger.annotations.ApiModelProperty;

public class BaseContext {
    private static final ThreadLocal<Long> CURRENT_LOCAL = new ThreadLocal<>();
    /**
     * 存储当前用户的id
     *
     * @param userId
     */
    public static void setCurrentId(Long userId) {
        CURRENT_LOCAL.set(userId);
    }

    /**
     * 获取当前用户的id
     *
     * @return 用户id
     */
    public static Long getCurrentId() {
        return CURRENT_LOCAL.get();
    }


    /**
     * 删除存储的员工id 释放内存
     */
    public static void remove() {
        CURRENT_LOCAL.remove();
    }

}
